---@class Table_SoundTempItem
local Table_SoundTempItem = class("Table_SoundTempItem");

function Table_SoundTempItem:ctor()
    self.Id = 0;    --唯一ID
    self.ResName = "";    --文件名称
    self.Volume = 0;    --音量
    self.IsLoop = false;    --是否循环
    self.SoundType = 0;    --音效类型
    self.PlayType = 0;    --播放类型
    self.MinDis = 0;    --最大音量
    self.MaxDis = 0;    --最小音量
    self.PosX = 0;    --音效点坐标
    self.PosY = 0;    --音效点坐标
    self.PosZ = 0;    --音效点坐标
end

function Table_SoundTempItem:Load(reader)
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Id = tonumber(self.temp); end
    self.ResName = reader:ReadString();
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.Volume = tonumber(self.temp); end
    self.IsLoop = reader:ReadBool();
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.SoundType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.PlayType = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.MinDis = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.MaxDis = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.PosX = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.PosY = tonumber(self.temp); end
    self.temp = reader:ReadShortString();
    if not Utility.IsNullOrEmpty(self.temp) then self.PosZ = tonumber(self.temp); end
    self.temp = nil;
end

---@class Table_SoundTempMgr : IDataMgr
local Table_SoundTempMgr = class("Table_SoundTempMgr", IDataMgr);

function Table_SoundTempMgr:FileName()
    return "Txt/SoundTemp.txt";
end

---@return Table_SoundTempItem
function Table_SoundTempMgr:GetItemById(id)
    return self.super:GetItemById(id)
end

---@return Table_SoundTempItem
function Table_SoundTempMgr:GetItemByIdx(idx)
    return self.super:GetItemByIdx(idx)
end

function Table_SoundTempMgr:Load(reader)
    local item = Table_SoundTempItem.new();
    item:Load(reader);
    self.mItemDic[item.Id] = self.mDataCount;
    table.insert(self.mItemList, item);
end

return Table_SoundTempMgr;